module.exports = function ($resource, $state, $http, $q, $modal, dlq, $timeout) {
	return {
		restrict: 'AE',
		template: require('../views/p_base.html'),
		replace: true,
		scope: {
			'p' : '=',
			//'other': '=',
			//'state' : '=',
			//'vm' : '=',
		},
		link: function (scope, elements, attrs) {

			console.log('base');

			console.log(scope.p);

			
scope.gogo = function(){

	var para = {
		'id' : scope.p.id,
		'sale_code' : scope.p.sale_code,
		'name' : scope.p.name,
		'guide_price' : scope.p.guide_price,
		'cost_price' : scope.p.cost_price,
		'market_price' : scope.p.market_price,
		'back_type' : scope.p.back_type,
		'isshow' : scope.p.isshow,
		'sms_type' : scope.p.sms_type,
		'sms_diy' : scope.p.sms_diy,
	};

	$resource('/api/ac/wc/productService/createWdProduct', {}, {}).save(para, function(res){
		console.log(res);
		if (res.errcode !== 0) {
			alert(res.errmsg);
			return;
		}
		
		alert('操作成功');

	});





};
		

		}
	};
};

